package com.ywh.composetest

import android.annotation.SuppressLint
import androidx.compose.foundation.clickable
import androidx.compose.foundation.interaction.MutableInteractionSource
import androidx.compose.runtime.remember
import androidx.compose.ui.Modifier
import androidx.compose.ui.composed

/**
 * 去除点击涟漪效果
 */
@SuppressLint("ModifierFactoryUnreferencedReceiver")
fun Modifier.clickableNoRipple(onClick: () -> Unit): Modifier =
    composed {
        Modifier.clickable(
            interactionSource = remember {
                MutableInteractionSource()
            }, indication = null,
            onClick = onClick
        )
    }